package com.example.demo.Controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.PostConstruct;

@Controller
@ResponseBody
public class TestController {

     @Value("${server.port}")
     private String myport;

     @PostConstruct
     public void doPostConstruct() {
         System.out.println("server port -> " + myport);
     }
    @RequestMapping("/sayHi")
    public String sayHi() {

        return "你好， Spring boot! " + myport  ;
    }

}
